package homework4.com.zut.aspectj_without_xml;


import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Component("transactionManager")
@Aspect
public class TransactionManager {
	@Pointcut("execution(* homework3.com.qianfeng.aspectj_without_xml.UserServiceImpl.*(..))")
	public void pc() {}
	
	@Before("pc()")
	public void beginTransaction() {
		System.out.println("");
	}
	
	@AfterReturning("pc()")
	public void commit() {
		System.out.println("ύ");
	}
	
	@AfterThrowing("pc()")
	public void rollback() {
		System.out.println("ع");
	}
	
	@After("pc()")
	public void release() {
		System.out.println("ͷԴ");
	}
	
}
